<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('修改用户密码')"/>
    <link th:href="@{/ruoyi/css/jquery-confirm.min.css}" rel="stylesheet"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-user-resetPwd">
        <div class="form-group">
            <label class="col-sm-3 control-label ">登录名称：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" readonly="true" name="loginName" th:value="${session.loginname}"/>
            </div>
        </div>
        <!--<div class="form-group">-->
            <!--<label class="col-sm-3 control-label">旧密码：</label>-->
            <!--<div class="col-sm-8">-->
                <!--<input class="form-control" type="password" name="oldPassword" id="oldPassword">-->
            <!--</div>-->
        <!--</div>-->
        <div class="form-group">
            <label class="col-sm-3 control-label">新密码：</label>
            <div class="col-sm-8">
                <input class="form-control" type="password" name="new" id="new">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">再次确认：</label>
            <div class="col-sm-8">
                <input class="form-control" type="password" name="loginPassword" id="confirm">
                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 请再次输入您的密码</span>
            </div>
        </div>
    </form>
</div>
<input name="userId" id="userid" type="hidden" th:value="${session.loginname}"/>
<th:block th:include="include :: footer"/>
<script th:src="@{/ruoyi/js/jquery-confirm.min.js}"></script>
<script>
    $("#form-user-resetPwd").validate({
        rules: {
            // oldPassword: {
            //     required: true,
            //     remote: {
            //         url: "/sbgl/sbuser/checkPassword",
            //         type: "get",
            //         dataType: "json",
            //         data: {
            //             password: function () {
            //                 return $("input[name='oldPassword']").val();
            //             }
            //         }
            //     }
            // },
            new: {
                required: true,
                minlength: 5,
                maxlength: 20
            },
            loginPassword: {
                required: true,
                equalTo: "#new"
            }
        },
        messages: {
            new: {
                required: "请输入新密码",
                minlength: "密码不能小于6个字符",
                maxlength: "密码不能大于20个字符"
            },
            loginPassword: {
                required: "请再次输入新密码",
                equalTo: "两次密码输入不一致"
            }

        },
        focusCleanup: true
    });
    function submitHandler() {
        var uId=$("#userid").val()
        if ($.validate.form()) {
            $.confirm({
                title: '温馨提示',
                content: '确定修改密码密码吗？？？',
                buttons: {
                    确定: {
                        text: '确定',
                        btnClass: 'btn-blue',
                        action: function(){
                            $.operate.saveuser("/sbgl/sbuser/resetPwd/"+uId, $('#form-user-resetPwd').serialize());
                            $.modal.close()
                        }
                    },
                    取消: {
                        text: '取消',
                        btnClass: 'btn-white',
                        action: function(){
                        }
                    }
                }
            });
        }
    }
</script>
</body>

</html>
